﻿<%@ Page Title="Title" Language="C#" Inherits="System.Web.Mvc.ViewPage<dynamic>" MasterPageFile="~/Views/Shared/Demo.Master" %>
<%@ Register TagPrefix="o" Namespace="Omu.AwesomeWebForms" Assembly="Omu.AwesomeWebForms, Version=1.0.0.0, Culture=neutral, PublicKeyToken=e8b65a0968999f7e" %>
<asp:Content runat="server" ID="Demo" ContentPlaceHolderID="DemoContent">
 <h1>AjaxList</h1>
    <p class="xpl">a list loaded via ajax, with search and pagination (more results button); 
    for each button a js function can be assigned, this function will receive the key (id) of that row </p>
    
    <h2>
        AjaxList with 2 buttons for each item
    </h2>

    <script type="text/javascript">
        function sayHi(o) {
            alert('say hi' + o);
        }
    </script>

    <asp:TextBox runat="server" ID="Name"></asp:TextBox>
    <input type="button" id="bsearch" value="search"/>
    <% 
        FruitsList.Buttons = new[]
                              {
                                  new AjaxListButton {Content = "hi", JsFunc = "sayHi"},
                                  new AjaxListButton {Content = "X", JsFunc = "alert"}
                              };
        FruitsList.Data = new Dictionary<string, string> { { "search", Name.ClientID } };
        FruitsList.SearchButton = "bsearch";
%>
    <o:AjaxList runat="server" ID="FruitsList" SearchUrl='~/svc/aja.svc/FruitSearch' />
  
  
  <h2>AjaxList with content layout defined by the service method that returns the data </h2>  
    <%
        FruitsListBtns.Buttons = new[]
                                     {
                                         new AjaxListButton{Content = "oO", JsFunc = "alert"}
                                     };
%>
    <o:AjaxList runat="server" ID="FruitsListBtns" SearchUrl='~/svc/aja.svc/FruitSearchWithButtons' />
</asp:Content>
